<template>
  <div id="accountinformation">
    <van-nav-bar
      title="账号信息"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
      class="nav"
    >
    </van-nav-bar>
    <div class="main">
      <!-- 小箭头 is-link -->
      <van-cell title="头像" class="avatar" center>
        <template #default>
          <img :src=" form.txurl == '' ? require('@/assets/images/avatar.png') : form.txurl " alt="" />
        </template>
      </van-cell>
      <van-cell title="用户名" :value="form.name"  center />
      <van-cell title="性别" :value="form.sex"  center />
      <van-cell title="出生日期" :value="form.birthday"  center />
      <van-cell title="身份证号" :value="form.idcard"  center />
      <van-cell title="从业年限" :value="form.years > 0 ? form.year : '1'+ '年'"  center />
      <van-cell title="联系方式" :value="form.phone"  center />
      <van-cell title="修改密码" @click="$router.push('/changePassword')"  is-link/>
    </div>
  </div>
</template>

<script>
import apiConfig from "../../../config/api.config";
import { my } from "@/apis/home";
export default {
  data() {
    return {
      apiConfig,
      form:'',
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1); //返回上一层
    },
     LoadMy() {
      my().then(res => {
       this.form = res.data.guwen
       console.log(this.form)
      });
    },
  },
  mounted() {
    this.LoadMy();
  }
};
</script>

<style lang="less">
#accountinformation {
  text-align: left;
  height: 100%;
  .van-nav-bar {
    background: rgba(241, 241, 241, 1);
  }
  .van-nav-bar__left {
    .van-icon {
      color: #404040;
    }
  }
  .nav {
    .van-icon,
    .van-nav-bar__text {
      color: #404040;
    }
  }
  .main {
    padding: 2px 20px;
    background-color: #fff;
    .van-cell {
      padding: 18px 0;
      &::after {
          left: 0;
          right: 0;
      }
      .van-cell__title {
        width: 35px;
      }
    }
    img{
      border-radius: 50%;
    }
  }
}
</style>
